package applet.misc.web;

import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;

public class WebsiteActionListener implements ActionListener
{
	private URL url;

	public WebsiteActionListener(String url)
	{
		try
		{
			this.url = new URL(url);
		}
		catch (MalformedURLException e) { e.printStackTrace(); }
	}
	
	public WebsiteActionListener(URL url)
	{
		this.url = url;
	}

	@Override
	public void actionPerformed(ActionEvent e)
	{
		try
		{
			Desktop.getDesktop().browse(url.toURI());
		}
		catch (IOException e1) { e1.printStackTrace(); } 
		catch (URISyntaxException e1) { e1.printStackTrace(); }
	}
}